<template>
      <div id="liliaodia">
            <el-dialog
            :title="DialogData.title"
            :visible.sync="DialogData.show"
            width="60%"
            >
                  <div class="form_box">
                        <el-form :model="FormData" status-icon  ref="ruleForm2" label-width="100px" class="demo-ruleForm">
                        <el-form-item label="项目ID" prop="pass" v-if="!DialogData.add">
                              <el-input type="text" v-model="FormData.id"  disabled auto-complete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="理疗名称" prop="pass">
                              <el-input type="text" v-model="FormData.title" auto-complete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="积分值" prop="checkPass">
                              <el-input type="text" v-model="FormData.score" auto-complete="off"></el-input>
                        </el-form-item>
                        </el-form>
                  </div>
            <span slot="footer" class="dialog-footer">
            <el-button @click="DialogData.show = false">取 消</el-button>
            <el-button type="primary" @click="SubForm">确 定</el-button>
            </span>
            </el-dialog>
      </div>
</template>

<script>
      export default {
            props: {
                  DialogData: Object,
                  FormData: Object
            },
            methods: {
                  // 添加或修改理疗项目
                  async SubForm() {
                        let { title, score } = this.FormData
                        let token = localStorage.miniToken
                        this.FormData.token = token
                        if (title && score) {
                              let res = await this.$axios.post("/admin/shop/therapy", this.FormData)
                              // console.log(res);
                              let code = res.data.code
                              if (code == 202 || code == 204) {
                                    this.$message.success("更新成功")
                              }
                              this.DialogData.show = false
                              this.$emit("update")
                        } else {
                              this.$message.error("请填写完整数据")
                        }
                  }
            },
      }
</script>

<style lang="scss" scoped>

</style>